/*
 * @Description  : 系统中心
 * @Autor        : 杜康
 * @Date         : 2023-03-07 17:57:39 +0800
 * @LastEditors  : 杜康
 * @LastEditTime : 2023-03-07 18:01:35 +0800
 */
import axios from "@/utils/api.request";
import system from "@/dao/system/index.js";
import Qs from "qs";
// -> 用户登录
export const login = (data) => {
  return axios.request({
    url: system.login,
    data,
    method: "POST"
  });
};

/**
 * @description: 获取项目列表
 * @param {*} data
 * @return {*}
 * @author: 杜康
 * @Date: 2022-10-15 13:24:05 +0800
 */
export const projectItem = (data = {}) => {
  return axios.request({
    url: system.projectItem,
    data,
    method: "GET"
  });
};

/**
 * @description: 删除项目
 * @param {*} data
 * @return {*}
 * @author: 杜康
 * @Date: 2022-10-22 16:17:12 +0800
 */
export const delWindow = (data) => {
  return axios.request({
    url: system.delWindow,
    data,
    method: "POST"
  });
};

// -> 获取楼号
export const projectBuilding = (data) => {
  return axios.request({
    url: system.projectBuilding,
    params: data,
    method: "GET"
  });
};

// -> 获取门窗列表
export const windowList = (data) => {
  return axios.request({
    url: system.windowList,
    params: data,
    method: "GET"
  });
};

// -> 获取用户列表
export const userList = (data) => {
  return axios.request({
    url: system.userList,
    params: data,
    method: "GET"
  });
};

// -> 添加用户
export const addUser = (data) => {
  return axios.request({
    url: system.addUser,
    data,
    method: "POST"
  });
};

// -> 删除用户
export const delUser = (data) => {
  return axios.request({
    url: system.delUser,
    data,
    method: "POST"
  });
};

// -> 上传文件
export const importWindows = (data) => {
  return axios.request(
    {
      url: system.importWindows,
      data,
      method: "POST"
    },
    "file"
  );
};

// -> 上传效果图
export const uploadPicture = (data) => {
  return axios.request(
    {
      url: system.uploadPicture,
      data,
      method: "POST"
    },
    "file"
  );
};

// -> 批量下载二维码
export const downloadBarcodes = (data) => {
  return axios.request(
    {
      url: system.downloadBarcodes,
      params: data,
      method: "GET"
    },
    "zip"
  );
};

// -> 批量更新
export const updatePipeline = (data) => {
  return axios.request({
    url: system.updatePipeline,
    data,
    method: "POST"
  });
};

//  -> 编辑
export const editWindow = (data) => {
  return axios.request({
    url: system.editWindow,
    data,
    method: "POST"
  });
};

// -> 重置密码(NEW)
export const resetPasswordAjax = (data) => {
  return axios.request({
    url: system.resetPasswordAjax,
    data: Qs.stringify(data),
    method: "POST"
  });
};
